package com.baizhi.service.impl;

import com.baizhi.mapper.CmfzBannerDAO;
import com.baizhi.entity.CmfzBanner;
import com.baizhi.service.CmfzBannerService;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class CmfzBannerServiceImpl implements CmfzBannerService {
    @Autowired
    private CmfzBannerDAO bannerDAO;
    @Override
    public Page<CmfzBanner> selectAllBanners(Integer page, Integer limit) {
        Page<CmfzBanner> bannerPage =
                bannerDAO.selectPage(new Page<CmfzBanner>(page, limit), null);
        return bannerPage;
    }

    @Override
    public CmfzBanner selectOneBannerById(Integer id) {
        return bannerDAO.selectById(id);
    }

    @Override
    public void insertBanner(CmfzBanner banner) {
        bannerDAO.insert(banner);
    }

    @Override
    public void deleteBannerById(Integer id) {
        bannerDAO.deleteById(id);
    }

    @Override
    public void updateBanner(CmfzBanner banner) {
        bannerDAO.updateById(banner);
    }
}
